home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CRT.SWG / 0027_Bright Backgrounds.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  1KB  |  67 lines

  1.  
  2. { I am wanting to enable Bright Background Colors in my Pascal programs.
  3.  
  4. Here's a little something:
  5.  
  6. {---cut here---}
  7.  
  8. uses Crt;
  9.  
  10. Procedure SetBlinkEGAVGA(BlinkOn : boolean); assembler;
  11. { Enables/disables bright background colors on EGA/VGA adapters }
  12. Asm
  13.   mov bl,BlinkOn
  14.   mov ax,1003h { BIOS function to enable/disable blinking }
  15.   int 10h
  16. End; { SetBlinkEGAVGA }
  17.  
  18. Procedure SetBlinkCGAMDA(BlinkOn : boolean); assembler;
  19. { Enables/disables 16 background colors on EGA/VGA adapters }
  20. Asm
  21.   mov dx,03D8h { default=CGA }
  22. {$IFDEF VER70} mov ax,Seg0040 {$ELSE} mov ax,0040h {$ENDIF}
  23.   mov es,ax
  24.   cmp byte ptr [es:0049h],07h   { mono mode? }
  25.   jne @@1
  26.   mov dx,03B8h { so its MDA }
  27. @@1:
  28.   mov ax,word ptr [es:0065h]
  29.   or  BlinkOn,False
  30.   jz  @@2
  31.   or  ax,20h
  32.   jmp @@3
  33. @@2:
  34.   and ax,0DFh
  35. @@3:
  36.   out dx,ax
  37. End; { SetBlinkCGAMDA }
  38.  
  39. Function EGAInstalled : boolean; assembler;
  40. Asm
  41.   mov ax,1200h
  42.   mov bx,0010h
  43.   xor cx,cx
  44.   int 10h
  45.   xor al,al { mov al,False }
  46.   or  cx,0
  47.   jz  @noega
  48.   inc al { al gets True }
  49. @noega:
  50. End; { EGAInstalled }
  51.  
  52. Begin
  53.   if EGAInstalled then
  54.     SetBlinkEGAVGA(False) else SetBlinkCGAMDA(False);
  55.   TextAttr := LightGray;
  56.   ClrScr;
  57.   TextAttr := Blue + White shl 4;
  58.   Write('Blue on bright White :)');
  59.   ReadKey;
  60.   GotoXY(1, 1);
  61.   Write('Blue on lightgray blinking :(');
  62.   if EGAInstalled then
  63.     SetBlinkEGAVGA(True) else SetBlinkCGAMDA(True);
  64.   TextAttr := LightGray;
  65.   WriteLn;
  66. End.
  67.